package com.peanut.baby.widget;

import android.text.TextPaint;
import android.text.style.ClickableSpan;
import android.view.View;

/**
 * Created by anonymouslystudio on 2017/9/20.
 */

public class NoLineClickSpan extends ClickableSpan {
    int  color;

    OnSpanClickedListener listener;
    public NoLineClickSpan(int color,OnSpanClickedListener listener) {
        super();
        this.color = color;
        this.listener = listener;
    }

    @Override
    public void updateDrawState(TextPaint ds) {
        ds.setColor(color);
        ds.setUnderlineText(false); //去掉下划线
    }

    @Override
    public void onClick(View widget) {
        if(listener != null){
            listener.processClick();
        }
    }

    public interface OnSpanClickedListener{
        void processClick();
    }
}
